Re: [SQL] Getting primary key from insert statement - Mailing list pgsql-sql

From Herouth Maoz
Subject Re: [SQL] Getting primary key from insert statement
Date
Msg-id l03130300b3812492cf77@[147.233.159.109]
Whole thread Raw
In response to Re: [SQL] Getting primary key from insert statement  ("Emils Klotins" <emils@mail.usis.bkc.lv>)
List pgsql-sql
At 12:51 +0300 on 07/06/1999, Emils Klotins wrote:


>
> Wouldn't it be simpler just to SELECT the next value from the sequence
>BEFORE the insert and
> use it in the INSERT statement directly?

Then you have to have a transaction around the two operations. And by the
time you do the select, someone may lock the table where you insert. It's a
potential for deadlock.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma




pgsql-sql by date:

Previous
From: "Emils Klotins"
Date:
Subject: Re: [SQL] Getting primary key from insert statement
Next
From: Michael J Davis
Date:
Subject: RE: [SQL] Getting primary key from insert statement